package com.zuihai.app.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.zuihai.app.mvp.contract.HomeRecyclerContract;
import com.zuihai.app.mvp.model.api.service.HomeService;
import com.zuihai.app.mvp.model.entity.BaseJson;
import com.zuihai.app.mvp.model.entity.HomeBanner;
import com.zuihai.app.mvp.model.entity.HomeItem;

import javax.inject.Inject;

import rx.Observable;

/**
 * Created by Administrator on 2017/5/4 0004.
 */

@FragmentScope
public class HomeRecyclerModel extends BaseModel implements HomeRecyclerContract.Model {
    private Gson mGson;
    private Application mApplication;
    private HomeService mHomeService;

    @Inject
    public HomeRecyclerModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
        mGson = new Gson();
        mHomeService = repositoryManager.obtainRetrofitService(HomeService.class);

    }

    @Override
    public Observable<BaseJson<HomeItem>> getActicle(String userId, int pageIndex,String type) {
        return mHomeService.requestActical(type,userId, pageIndex);
    }


    @Override
    public Observable<BaseJson<HomeItem>> requestPeriphery(String userId, int pageIndex) {
        return  mHomeService.requestPeriphery("206",userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestActivity(String userId, int pageIndex) {
        return mHomeService.requestActivity("207",userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestActical(String userId, int pageIndex) {
        return mHomeService.requestActical("202",userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestSecret(String userId, int pageIndex) {
        return mHomeService.requestSecret(userId, pageIndex,"201");
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestShopping(String userId, int pageIndex) {
        return mHomeService.requestShopping("205",userId, pageIndex);
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestPersion(int pageIndex, String userId) {
        return mHomeService.requestPersion("105",pageIndex, userId);
    }

    @Override
    public Observable<BaseJson<HomeItem>> requesHelp(int pageIndex, String userId) {
        return mHomeService.requestHelp("107",pageIndex, userId);
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestStory(int pageIndex, String userId) {
        return mHomeService.requestStory(pageIndex, userId,"106");
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestHot(int pageIndex,String userID) {
        return mHomeService.requestHot(pageIndex, userID,"103");
    }

    @Override
    public Observable<BaseJson<HomeBanner>> requestBanner() {
        return mHomeService.requestBanner();
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestRecommend(int pageIndex, String userId) {
        return mHomeService.requestRecomment(1, pageIndex, userId);//首页-推荐请求列表数据（TAG = 1）
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestHeadline(int pageIndex, String userId) {
        return mHomeService.requestHeadlin(101, pageIndex, userId);//首页-今日头条请求列表数据（TAG = 2）
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestFindRecommend(int pageIndex, String userId) {
        return mHomeService.requestFindRecomment(pageIndex,userId);
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestDiary(int pageIndex, String userId) {
        return mHomeService.requestDiary(3, pageIndex, userId);//首页-酒城日记请求列表数据（TAG = 3）
    }

    @Override
    public Observable<BaseJson<HomeItem>> requestPicture(int pageIndex, String userId,String type) {
        return mHomeService.requestPicture(pageIndex,userId,type);

    }

    @Override
    public Observable<BaseJson<HomeItem>> requestMyHeadline(String userId, String myID, int pageIndex) {
        return mHomeService.myHomeHeadline(myID,pageIndex,userId);
    }




}